<?php
require_once dirname(__FILE__)."/../../../classes/Posts.class.php";

if(isset($_POST['add'])){ 
    require_once dirname(__FILE__)."/add.php";
}    
?>

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">

  <br /> Категория: <br />
  <select name="categories" >  
    <?php
        $cat = Posts::show_categories(); 
        //вывод категорий в select
        foreach($cat as $value){
            $name =  $value['cat_name'];
    ?>
    <option> <?php  echo $name; ?></option>
    <?php  } ?>
  </select> <br />
  <br /> Видимость: <br />
  <select name="visible" >  
    <option value="1">Отображать</option>
    <option value="0">Не отображать</option>
  </select>  <br />
  
  <br /> Название <br />
  <textarea rows="5" cols="80" name="name">
  </textarea>
  

  <br /> Пре-текст <br />
  <textarea rows="15" cols="80" name="short">
  </textarea> 
  
  <br /> Текст <br />
  <textarea name="content" id="editor1" cols="45" rows="5"></textarea>
  <script type="text/javascript">
   CKEDITOR.replace( 'editor1',
   {
       filebrowserBrowseUrl : '/ckfinder/ckfinder.html',
       filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?type=Images',
       filebrowserFlashBrowseUrl : '/ckfinder/ckfinder.html?type=Flash',
       filebrowserUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
       filebrowserImageUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
       filebrowserFlashUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
   });
  </script>
  
  <br /> Тайтл <br />
  <textarea rows="5" cols="40" name="title">
  </textarea>
  
  <br /> Описание <br />
  <textarea rows="5" cols="40" name="description">
  </textarea>
  
  <br /> Ключевые слова <br />
  <textarea rows="5" cols="40" name="keywords">
  </textarea><br />

  <input type="submit" name="add" class="button" value="Создать">
</form>
